﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using T0yK4T.IO;
using ToyChat.Server;

namespace ToyChat
{
    /// <summary>
    /// An interface used describe a channel for ToyChat
    /// </summary>
    public interface IChannel
    {
        /// <summary>
        /// Checks wether or not the specified user is currently in this channel
        /// </summary>
        /// <param name="user">The user to check for</param>
        /// <returns>True if the user is currently in this channel, otherwise false</returns>
        bool ContainsUser(IUser user);

        /// <summary>
        /// Adds the specified user to this channel
        /// </summary>
        /// <param name="user">The user to add</param>
        void AddUser(IUser user);

        /// <summary>
        /// Gets or Sets the ToyChat channel ID of the channel
        /// </summary>
        int ChannelID { get; set; }

        /// <summary>
        /// Gets or Sets a value indicating wether or not this channel is hidden
        /// </summary>
        bool IsHidden { get; set;}
        
        /// <summary>
        /// Gets or Sets the name of the channel
        /// </summary>
        string ChannelName { get; set; }

        /// <summary>
        /// Gets or Sets the MotD for this channel
        /// </summary>
        string MotD { get; set; }

        /// <summary>
        /// Gets or Sets the password for this channel
        /// </summary>
        string Password { get; set; }

        /// <summary>
        /// Removes the specified user from this channel
        /// </summary>
        /// <param name="user">The user to remove</param>
        void RemoveUser(IUser user);

        /// <summary>
        /// Removes the specified user from this channel and broadcasts the specified reason to all other users in this channel
        /// </summary>
        /// <param name="user">The user to remove</param>
        /// <param name="reason">The reason the user was removed</param>
        void RemoveUser(IUser user, string reason);

        /// <summary>
        /// Sends the specified packet to all users currently in this channel
        /// </summary>
        /// <param name="packet">The packet to send</param>
        void Send(Packet packet);

        /// <summary>
        /// Gets a value indicating how many users are currently in this channel
        /// </summary>
        int UserCount { get; }

        /// <summary>
        /// Gets a list of all the users currently in this channel
        /// </summary>
        IEnumerable<IUser> Users { get; }
    }
}
